{php include wl_template('common/header');}
<ul class="nav nav-tabs">
	<li {if $operation == 'display'} class="active" {/if}><a href="{php echo web_url('member/time',array('op' =>'display'))}">活动前提醒推送列表</a></li>
	<li {if empty($list['id']) && $operation == 'post'} class="active" {/if}><a href="{php echo web_url('member/time',array('op' =>'post'))}">添加活动前提醒推送</a></li>
	{if !empty($list['id']) &&  $operation == 'post'}<li class="active"><a href="{php echo web_url('member/time',array('op' =>'post','id'=>$blacklist['id']))}">编辑活动前提醒推送</a></li>{/if}
</ul>

{if $operation == 'display'}
<div class="main panel panel-default">
	<div class="panel-body table-responsive">
		<table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
					<th style="width:5%;">ID</th>
					<th style="width:15%;">公众号编号</th>
					<th style="width:35%;">活动前提醒时间</th>
					<th style="width:20%;">自动添加黑名单次数</th>
					<!--<th style="width:15%;">适用人群</th>-->
					<th class="text-center" style="width:10%;text-align: center">操作</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $list}
				<tr>
					<td>{$list['id']}</td>
                    <!--<td>-->
                        <!--<img width='45' height="45" src="{IMAGE_PIXEL}" data-url="{php echo tomedia($blacklist['pic']);}" class="scrollLoading" onerror="this.src='{IMAGE_NOPIC_SMALL}'" />-->
                    <!--</td>-->
					<!--<td>{$blacklist['name']}</td>-->
					<td>{$list['uniacid']}</td>
					<td>{$list['activity']}</td>
					<td>{$list['blacktime']}</td>
					<td class="text-right">
						<a href="{php echo web_url('member/time', array('op' => 'post', 'id' => $list['id']))}" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="top" title="修改"><i class="fa fa-edit"></i></a>
						<a href="javascript:;" c-id="{$list['id']}" class="btn btn-default btn-sm js-delete" data-toggle="tooltip" data-placement="top" title="删除"><i class="fa fa-times"></i></a>
					</td>
				</tr>
				{/loop}
			</tbody>
		</table>
		{$pager}
	</div>
</div>
<script>
	require(['bootstrap'],function($){
		$('.btn').hover(function(){
			$(this).tooltip('show');
		},function(){
			$(this).tooltip('hide');
		});
	});
	$(function(){
        $(".scrollLoading").scrollLoading();
        var $pop = null;
        $('.scrollLoading').hover(function(){
            var img = $(this).attr('src');
            var obj = this;
            var $pop = util.popover(obj, function($popover, obj){
                obj.$popover = $popover;
            }, '<div><img src="'+img+'" style="max-width:200px; max-height:200px;"></div>');
        }, function(){
            this.$popover.remove();
        });
        $('.js-delete').click(function(e) {
            e.stopPropagation();
            var cid = $(this).attr('c-id');
            var $this = $(this);
            util.nailConfirm(this, function(state) {
                if (!state) {
                    return;
                }
                $.post("{php echo web_url('member/time/delete')}", {id : cid}, function(data) {
                    if(!data.errno){
                        $this.parent().parent().remove();
                    };
                    util.tips(data.message);
                }, 'json');
            });
        });
    });
</script>
{elseif $operation == 'post'}
<div class="main">
	<form action="" method="post" class="form-horizontal form" onsubmit='return formcheck()'>
		<input type="hidden" name="id" value="{$list['id']}" />
		<div class="panel panel-default">
			<div class="panel-heading">
				活动前提醒推送管理
			</div>
			<div class="panel-body">
				<div class="form-group">
					<label class="col-md-2 control-label">活动前提醒标题</label>
					<div class="col-md-8">
						<input type="hidden" name="id" value="{$list['id']}"/>
						<input type="text" class="form-control" name="title" value="{$list['title']}" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-md-2 control-label">活动前提醒名称</label>
					<div class="col-md-8">
						<input type="text" class="form-control" name="name" value="{$list['name']}" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-md-2 control-label">活动前提醒类型</label>
					<div class="col-md-8">
						<input type="text" class="form-control" name="type" value="{$list['type']}" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-md-2 control-label">活动前提醒备注</label>
					<div class="col-md-8">
						<input type="text" class="form-control" name="remark" value="{$list['remark']}" />
					</div>
				</div>
			</div>
		</div>
		<div class="form-group col-sm-12">
			<input type="submit" name="submit" onclick="formcheck()" value="提交" class="btn btn-primary col-lg-1" />
			<input type="hidden" name="token" value="{$_W['token']}" />
		</div>
	</form>
</div>
{/if}
{php include wl_template('common/footer');}